package itsm.isperp.framework.web.converter;

import itsm.isperp.framework.utils.DateUtils;

import java.io.IOException;

import oracle.sql.TIMESTAMP;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

/**
 * 
 * 
 * 
 * @author lizx
 * @date 2014-11-23
 * @since 1.0
 * 
 */
public class OracleDateTimeJsonSerializer extends JsonSerializer<TIMESTAMP> {

	public static final Logger logger = LoggerFactory
			.getLogger(OracleDateTimeJsonSerializer.class);

	@Override
	public void serialize(TIMESTAMP date, JsonGenerator json,
			SerializerProvider provider) throws IOException,
			JsonProcessingException {

		json.writeString(DateUtils.getDateTimeformat().format(date));

	}
}
